package com.tom.redisapplication.model.entity;

/**
 * 基础响应
 *
 * @author zx
 * @date 2024年12月25日 10:24
 */
public class BaseResponse<T> {
    private String msg;
    private Integer code;
    private T data;

    private BaseResponse(String msg, Integer code, T data) {
        this.msg = msg;
        this.code = code;
        this.data = data;
    }

    public static <T> BaseResponse<T> success(T data) {
        return new BaseResponse<>("success", 200, data);
    }
    public static <T> BaseResponse<T> success() {
        return new BaseResponse<>("success", 200, null);
    }

    public static <T> BaseResponse<T> fail(T data) {
        return new BaseResponse<>("success", 500, data);
    }
    public static <T> BaseResponse<T> fail() {
        return new BaseResponse<>("success", 500, null);
    }


}
